Repository navigation
Conversation
|
There was a problem hiding this comment.
🟡 Changes recommended
Critical secret-dependent timing and memory-access leaks remain in ECC reductions, signing, and shared-secret export, while exponentiation now rejects supported boundary-size moduli.
4 open issues
What changed in this PR
This PR strengthens timing resistance in wolfCrypt’s ECC operations and its TFM and SP arithmetic backends.
Changes:
- Routes ECC point arithmetic, mapping, and signing through constant-time helpers, and uses fixed-length ECDH output encoding.
- Adds fixed-width TFM modular exponentiation, including base-2 and nonblocking paths.
- Revises SP Montgomery reduction with masked subtraction and constant-time result-length calculation.
| File | Description |
|---|---|
wolfssl/wolfcrypt/tfm.h |
Declares constant-time comparison functions for TFM. |
wolfcrypt/src/tfm.c |
Adds fixed-width exponentiation and constant-time reduction and comparison helpers. |
wolfcrypt/src/sp_int.c |
Updates constant-time Montgomery reduction and inversion paths. |
wolfcrypt/src/ecc.c |
Integrates timing-resistant arithmetic into ECC operations and shared-secret encoding. |
Review effort: Balanced
58072bc to
23d0e51
Compare
|
@claude review |
There was a problem hiding this comment.
🟡 Changes recommended
Four critical findings remain: an uninitialized multiplication temporary and capacity violations in multiplication, reduction, and padded export can produce invalid results or access memory out of bounds.
4 open issues
4 resolved since last review
Review effort: Balanced
23d0e51 to
d7e25ec
Compare
|
@claude review |
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved critical defects can cause out-of-bounds memory access, silently incorrect exponentiation results after allocation failures, and secret-dependent timing in elliptic-curve operations.
4 open issues
4 resolved since last review
Review effort: Balanced
Use constant time Montgomery reduction and compares in ECC point operations, ECDH shared secret output and ECDSA signing mod n. Constant time, fixed length TFM modular exponentiation including base 2.
d7e25ec to
da600b8
Compare


Description
Use constant time Montgomery reduction and compares in ECC point operations, ECDH shared secret output and ECDSA signing mod n. Constant time, fixed length TFM modular exponentiation including base 2.
Fixes zd#22789, zd#22790, zd#22798
Testing
./configure --eable-sp-math-all
./configure --enable-fastmath